home *** CD-ROM | disk | FTP | other *** search
/ Hacks & Cracks / Hacks_and_Cracks.iso / manuals / cracking manual / crack.txt < prev    next >
Text File  |  1999-04-06  |  91KB  |  2,266 lines

  1.                                                    The Cracking Manual
  2.          ─────────────────────────────────────────────────────────────
  3.                                  Written By The Cyborg - April 3, 1992
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.          Disclaimer
  12.          The author of this text shall hold no liability for special,
  13.          incidental, or consequential damages arising out of or
  14.          resulting from the use/misuse of the information in this
  15.          file.
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.                                                    The Cracking Manual
  25.  
  26.  
  27.  
  28.                                   INTRODUCTION
  29.  
  30.          Introduction
  31.          ------------
  32.               Welcome to the wonderful world of cracking.  What is
  33.          cracking?  If you don't know and you're reading this, ask
  34.          yourself why?  Anyway, cracking is the art of removing copy
  35.          protected coding from programs.  Why do this?  In recent
  36.          years, software companies have been fighting to keep copy
  37.          protection in their software to avoid their work to be
  38.          illegally copied.  Users feel that such copy protection is
  39.          ridiculous in that it violate their own rights to make
  40.          backups of their sometimes expensive investments.
  41.               Whichever side you may favor, this manual will go into
  42.          some detail on removing copy protection from programs.  If
  43.          you feel offended by this, then I would suggest you stop
  44.          here.  Please note, I do not endorse cracking for the illegal
  45.          copying of software.  Please take into consideration the hard
  46.          work and effort of many programmers to make the software.
  47.          Illegal copying would only increase prices on software for
  48.          all people.  Use this manual with discretion as I place into
  49.          your trust and judgement with the following knowledge.
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.                                      Page 1
  85.  
  86.  
  87.  
  88.  
  89.  
  90.                                                    The Cracking Manual
  91.  
  92.  
  93.  
  94.                                WHAT YOU WILL NEED
  95.  
  96.          What You Will Need
  97.          ------------------
  98.               Like all programming, cracking is the debugging stage of
  99.          software development.  It is the most tedious and hectic part
  100.          of programming as you shall see.  However, unlike software
  101.          development, you are given no source code, only the machine
  102.          level code commonly called machine language.  Cracking
  103.          demands patience.  No patience, no cracking.
  104.               Before we begin, you will need certain tools.  These
  105.          include:
  106.  
  107.               - A decent computer.  By this, I mean at minimum a 286
  108.                 computer with 2 or more megs of RAM.  A 386 is the
  109.                 ideal since it can load a debugger into usable memory.
  110.               - A source level debugger (eg. Turbo Debugger)
  111.               - A low level debugger (eg. DEBUG)
  112.               - An assembler system (eg. MASM, LINK, EXE2BIN)
  113.               - A hex dumping program (eg. Norton Utilities)
  114.  
  115.          The source level debugger is what you will try to be using
  116.          most of the time.  It provides many features that are a
  117.          convenience to the cracker, such as interrupt redirection.
  118.          Become comfortable with its features.  However, in some
  119.          instances, the source level debugger may not be suitable for
  120.          cracking huge games since the debugger itself may take up too
  121.          much memory.  In such a case, a low level debugger must be
  122.          used since their memory usage may be considered negligible.
  123.          This manual will focus on its use.
  124.               The assembler package will be used in the creation of
  125.          the famed loaders, which provide the cracker with dynamic
  126.          memory alterations without changing the original program.
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.                                      Page 2
  151.  
  152.  
  153.  
  154.  
  155.  
  156.                                                    The Cracking Manual
  157.  
  158.  
  159.  
  160.                        CRASH COURSE IN ASSEMBLY LANGUAGE
  161.  
  162.          Crash Course in Assembly Language
  163.          ---------------------------------
  164.               If you are already well familiar with the assembly
  165.          language, you may wish to skip this section.  Cracking
  166.          demands the knowledge of assembly language.  If you wish to
  167.          become a "serious" cracker, you might like to read up more
  168.          about this fascinating language.  This section will only give
  169.          you enough info for intermediate level cracking.
  170.               At this point, you should familiarize yourself with
  171.          DEBUG and its commands as we will be using them shortly.
  172.  
  173.          Registers
  174.          ---------
  175.               One of the neato things that you will be fooling around
  176.          most often with are called the registers.  Registers are like
  177.          variables (such as in BASIC) that are located within the CPU
  178.          itself.  These registers may hold a positive integer from 0
  179.          to 255 or from 0 to 65535.  They can also hold negative
  180.          integers from -128 to 127 or from -32768 to 32767.  The
  181.          registers are given names as follows:
  182.  
  183.               AX => accumulator - this register is most commonly used
  184.                     for mathematical or I/O operations
  185.               BX => base - this register is used commonly as a base or
  186.                     a pointer register (we'll talk more about this
  187.                     later)
  188.               CX => count - used commonly for counting instructions
  189.                     such as loops
  190.               DX => displacement - much like the base register
  191.  
  192.          The registers stated above are considered general purpose
  193.          registers, since they can basically be used to store whatever
  194.          the user wants.  Let's try putting some number in these
  195.          registers.  Type in "R {enter}".  You should see a bunch of
  196.          info, of which are four of the above mentioned registers.
  197.          Now, type in "RAX {enter}".  Then type in a number like
  198.          8FABh.  Type in "R" again and noticed how the accumulator
  199.          (AX) has change its number.
  200.               These general purpose registers can also be "split" in
  201.          half into its higher and lower order components.  Instead of
  202.          having one register AX, you can have two registers, AH and
  203.          AL.  Note however that while you have a range of 0 to FFFFh
  204.          for AX, you will now have a range of 0 to FF for AH and AL.
  205.          You cannot change these directly in debug, but be aware that
  206.          programs will use it.  If AX contains 0A4Ch, then AH will
  207.          contain 0Ah and AL will contain 4Ch.
  208.               The following are called the segment registers:
  209.  
  210.               CS => code segment - the block of memory where the code
  211.                     (instructions are located)
  212.               DS => data segment - the block of memory where data can
  213.                     be accessed.  In block move operations in which
  214.  
  215.  
  216.                                      Page 3
  217.  
  218.  
  219.  
  220.  
  221.  
  222.                                                    The Cracking Manual
  223.  
  224.  
  225.  
  226.                     huge blocks of memory are moved, this is commonly
  227.                     the segment in which the CPU reads from.
  228.               ES => extra segment - also another data segment.  In
  229.                     block move operations in which huge blocks of
  230.                     memory are moved, this is commonly the segment in
  231.                     which the CPU writes to.
  232.               SS => stack segment - this is the block of memory in
  233.                     which the CPU uses to store return addresses from
  234.                     subroutines.  (more on this later)
  235.  
  236.          In introductory level of cracking, we don't mess around with
  237.          these registers.  Later, we will see how we can use these to
  238.          trick a program into thinking other things, but that's later.
  239.          You can also change these registers in debug.  Type in "RCS
  240.          {enter}".  Then enter "0 {enter}" and notice how the CS
  241.          register changed.
  242.               There are other registers that we use to see what the
  243.          program is doing.  These registers can also be change in
  244.          debug.  Included are the following:
  245.  
  246.               SI => source index - this register is used in
  247.                     conjunction with block move instructions.  This is
  248.                     a pointer within a segment (usually DS) that is
  249.                     read from by the CPU.
  250.               DI => destination index - this register is also used in
  251.                     conjunction with block move instructions.  This is
  252.                     a pointer within a segment (usually ES) that is
  253.                     written to by the CPU.
  254.               BP => base pointer - a pointer used commonly with the
  255.                     stack segment
  256.               SP => stack pointer - another pointer used commonly with
  257.                     the stack segment (this one, you don't touch)
  258.  
  259.               By now, you may probably be confused about this
  260.          segment/pointer bit.  Here is an analogy that my straighten
  261.          things out.
  262.               Pretend you are in kindergarden learning to read.  There
  263.          are four black boards surrounding the room.  These black
  264.          boards are like SEGMENTS.  Let's pretend the front blackboard
  265.          is the code segment (CS).  The teacher has written some
  266.          instructions on pronunciation rules.  This is what the
  267.          students refer to when they try to pronounce words.  In a
  268.          program, this is what the CPU refers to when it follows
  269.          directions.
  270.               Okay, now the teacher has gone to the blackboard on the
  271.          left of the classroom.  We will call this board the data
  272.          segment (DS).  The teacher has also written a set of words on
  273.          the board.  Then she uses a wooden stick or a POINTER to
  274.          point to a word.  Let's pretend this stick is the source
  275.          index (SI).  She points to the word "their".  Now, the
  276.          students look at the front blackboard (CS) to see how to
  277.          pronounce the word and they say "their".
  278.               Now, the instructor wants the students to learn how to
  279.          write.  She points the stick to the word "apple".  The
  280.  
  281.  
  282.                                      Page 4
  283.  
  284.  
  285.  
  286.  
  287.  
  288.                                                    The Cracking Manual
  289.  
  290.  
  291.  
  292.          students pronounce the word.  Then she goes to the blackboard
  293.          on the right.  We shall call this one the extra segment (ES).
  294.          She then uses her finger as a different POINTER and points to
  295.          a location on the board where Mary Jane will write "apple".
  296.               That's basically what segments and pointers are.
  297.          Segments are the blackboards and pointers are the teacher's
  298.          stick (we're not talking sexually here) or finger.
  299.               One last important register is the flags register.
  300.          These registers control how certain instruction work, such as
  301.          the conditional jumps (in BASIC, they are like IF-THEN's).
  302.          They are stored as bits (0's or 1's) in the flags register.
  303.          We will most often use:
  304.  
  305.               zero => ZR/NZ (zero/not zero) - tells you whether an
  306.                       instruction (such as subtraction) yielded a zero
  307.                       as an answer
  308.               sign => NG/PL (negative/positive) - tells you whether an
  309.                       instruction yielded a positive or negative
  310.                       number
  311.               carry => CY/NC (carry/no carry) - tells you whether an
  312.                       instruction needed to carry a bit (like in
  313.                       addition, you carry a number over to the next
  314.                       digit).  Various system (BIOS) functions use
  315.                       this flag to denote an error.
  316.               direction => DN/UP (decrement/increment) - tells a block
  317.                       instruction to either move forward or backwards
  318.                       in reads and writes
  319.  
  320.          Try changing some of these bits.  Type in "RF {enter}".  Then
  321.          type in "DN {enter}" to change the direction flag to its
  322.          decrement position.
  323.  
  324.          The Instructions
  325.          ----------------
  326.  
  327.          MOV - move
  328.          ----------
  329.               Now we get to the actual instructions or commands that
  330.          the CPU will use.  The first instruction you will see most
  331.          often is the move instruction.  Its form is
  332.          MOV {destination},{source}.  Let's try programming now.  Exit
  333.          (q) and reenter debug again.  Now, type in "A {enter}".  You
  334.          will see a bunch of number to the left.  You can think of
  335.          these as line numbers.  Now type in "MOV AX,7A7A {enter}".
  336.          Then type "MOV DX,AX" and so on until your program looks
  337.          similar to the one below:  (type "U 100" to see)
  338.  
  339.          xxxx:0100 B8A77A         MOV    AX,7AA7
  340.          xxxx:0103 89C2           MOV    DX,AX
  341.          xxxx:0105 B90000         MOV    CX,0000
  342.          xxxx:0108 88D1           MOV    CL,DL
  343.          xxxx:010A 890E0005       MOV    [0500],CX
  344.          xxxx:010E 8B160005       MOV    DX,[0500]
  345.          xxxx:0112 BB0200         MOV    BX,0002
  346.  
  347.  
  348.                                      Page 5
  349.  
  350.  
  351.  
  352.  
  353.  
  354.                                                    The Cracking Manual
  355.  
  356.  
  357.  
  358.          xxxx:0115 26A30005       MOV    ES:[0500],AX
  359.  
  360.          Press enter again until you see the "-" prompt again.  You
  361.          are ready to run your first program.  Type "R {enter}" and
  362.          note the values of the general purpose registers.  Then type
  363.          in "T {enter}".  Debug will automatically display the
  364.          registers after the execution of the instruction.  What is in
  365.          the AX register?  It should be 7AA7h.  Now, "T" again.  What
  366.          is in the DX register?  It should also be 7AA7h.  Trace again
  367.          using "T" and note that CX should be 0 if it was not already.
  368.          Trace again and note what is in the CX register.  It should
  369.          be 00A7h.  Now trace another step.  What is this instruction
  370.          doing?  It is now moving the contents of CX into memory
  371.          location 500h in the data segment (DS).  Dump the memory by
  372.          typing in "D 500".  The first two two-digit numbers should be
  373.          the same as in the CX register.  But wait a minute you say.
  374.          They are not the same.  They are backwards.  Instead of
  375.          00A7h, it is A700h.  This is important.  The CPU stores 16
  376.          bit numbers in memory backwards to allow for faster access.
  377.          For 8 bit numbers, it is the same.  Now, continue tracing.
  378.          This instruction is moving the memory contents of address
  379.          500h into the DX register.  DX should be 00A7h, the same as
  380.          CX regardless of how it looked in memory.  The next trace
  381.          should be nothing new.  The next trace again moves the
  382.          contents of a register into memory.  But notice it is using
  383.          the BX register as a displacement.  That means it adds the
  384.          contents of BX and 500h to get the address, which turns out
  385.          to be 502h.  But also not the "ES:" in front of the address.
  386.          This additional statement tells the CPU to use the extra
  387.          segment (ES) rather than the data segment (DS which is the
  388.          default).  Now dump address 502h by entering "D ES:502" and
  389.          you should see A77Ah, which is backwards from 7AA7h.
  390.  
  391.          CMP/J? - compare/conditional jump
  392.          ---------------------------------
  393.               Another instruction you will see quite often is the CMP
  394.          or compare instruction.  This instruction compares the two
  395.          "variables" and changes the flags register accordingly.  The
  396.          source and destination operands are the same as those for the
  397.          move instruction.
  398.               Let's consider an example in which the AX register holds
  399.          21 and the BX register holds 22.  Then "CMP AX,BX" is
  400.          performed.  The compare instruction is like a subtraction
  401.          instruction, but it doesn't change the contents of the AX
  402.          register.  So, when 22 is subtracted from 21, the answer will
  403.          be -1, but we will never see the answer, only the flags which
  404.          have resulted from the operation.  Number 21 is less than 22,
  405.          so the carry flag and the sign flag should be set.  Just
  406.          remember that when the carry flag is set, the first number is
  407.          less than the second number.  The same is true for the sign
  408.          flag.  Why have two flags if they tell us the same thing?
  409.          This is more complicated and you should not concern yourself
  410.          with it.  It requires knowledge of hexadecimal arithmetic,
  411.          the denotation of signed and unsigned integers.
  412.  
  413.  
  414.                                      Page 6
  415.  
  416.  
  417.  
  418.  
  419.  
  420.                                                    The Cracking Manual
  421.  
  422.  
  423.  
  424.               So, now that we have done the compare instruction, there
  425.          will most likely be a conditional jump instruction after.  If
  426.          we wanted to jump if AX is less than BX (which it is), then
  427.          there would be an instruction like "JB 200".  This
  428.          instruction says Jump if Below to instruction 200h.  What
  429.          about if we wanted to jump if AX is greater than BX.  Then we
  430.          might have "JA 200".  This is read Jump if Above to
  431.          instruction 200.  What about AX equal to BX.  We would then
  432.          have "JZ 200" or "JE 200".  (Please note that the previous
  433.          instructions are synonymous.)  This is read Jump if Equal to
  434.          instruction 200h.  Here are the jumps you will most likely
  435.          encounter:
  436.  
  437.               Mnemonic  Flag(s) Checked  Description
  438.          -------------------------------------------------------------
  439.               JB/JNAE   CF=1             Jump if below/not above or
  440.                                          equal (unsigned)
  441.               JAE/JNB   CF=0             Jump if above or equal/not
  442.                                          above (unsigned)
  443.               JBE/JNA   CF=1 or ZF=1     Jump if below or equal/not
  444.                                          above (unsigned)
  445.               JE/JZ     ZF=1             Jump if equal/zero
  446.               JNE/JNZ   ZF=0             Jump if not equal/not zero
  447.               JL/JNGE   SF not equal     Jump if less/not greater or
  448.                         to OF            equal (signed)
  449.               JGE/JNL   SF=OF            Jump if greater or equal/not
  450.                                          less (signed)
  451.               JLE/JNG   ZF=1 or SF       Jump is less or equal/not
  452.                         not equal OF     greater (signed)
  453.               JG/JNLE   ZF=0 or SF=OF    Jump if greater/not less or
  454.                                          equal (signed)
  455.               JS        SF=1             Jump if sign
  456.               JNS       SF=0             Jump if no sign
  457.               JC        CF=1             Jump if carry
  458.               JNC       CF=0             Jump if no carry
  459.               JO        OF=1             Jump if overflow
  460.               JNO       OF=0             Jump if not overflow
  461.               JP/JPE    PF=1             Jump if parity/parity even
  462.               JNP/JPO   PF=0             Jump if no parity/parity odd
  463.  
  464.          There are all the possible combinations of conditional jumps
  465.          that you will encounter.  I realize that we have not
  466.          discussed some of the flags such as overflow or parity, but
  467.          be aware that they exist and programs sometimes use them.
  468.  
  469.          JMP - jump
  470.          ----------
  471.               This instruction does what it suggests.  It jumps too
  472.          different sections of code.  Several forms of the jump
  473.          instruction include:
  474.  
  475.          2E0B:0208 EBF6           JMP    0200
  476.          2E0B:020A 3EFF24         JMP    DWORD PTR DS:[SI]
  477.  
  478.  
  479.  
  480.                                      Page 7
  481.  
  482.  
  483.  
  484.  
  485.  
  486.                                                    The Cracking Manual
  487.  
  488.  
  489.  
  490.          The first instruction jumps to an address within the segment.
  491.          The latter instruction jumps to an address pointed to by ds:
  492.          si.  The DWORD says that this will be a far jump, a jump to a
  493.          different segment (a different blackboard).  So, if the
  494.          double word that is pointed to by ds:si contains 1000:0040h,
  495.          then, the instruction will jump to 1000:0040h whereas the
  496.          previous jump instruction will jump within the current
  497.          segment (or blackboard).
  498.  
  499.          CALL - procedural transfer
  500.          --------------------------
  501.               This instruction is the baby that you will be carefully
  502.          watching out for most often.  This instruction calls another
  503.          procedure and upon it's completion, will return to calling
  504.          address.  For example, consider the following block of code:
  505.  
  506.          2E0B:1002 E8BB46         CALL   56C0
  507.          2E0B:1005 7209           JB     1010
  508.          2E0B:1007 0C00           OR     AL,00
  509.  
  510.          The first line calls another procedure at "line number"
  511.          56C0h.  Upon its completion, the instruction pointer will
  512.          point to the second line.  Note that there is a "JC"
  513.          instruction.  Remember that programs often use the carry flag
  514.          to signal errors.  If the call instruction called a copy
  515.          protection instruction and you entered a wrong code or
  516.          something, it may return with the carry flag set.  The next
  517.          instruction would then jump if there was an error to an
  518.          exiting procedure.
  519.               Note, this is a near call.  A program can also have far
  520.          calls just like jumps.
  521.  
  522.          INT - generate an interrupt
  523.          ---------------------------
  524.               This instruction is much like the call instruction.  It
  525.          also transfers control to another procedure.  However, the
  526.          number after the INT instruction does not point to an
  527.          address.  Instead, it is a number pointing to an address that
  528.          is located in something called an interrupt vector.  You will
  529.          commonly see "INT 10", "INT 21", "INT 13".  Just know (for
  530.          now) that they are like calls to procedures.
  531.  
  532.          LODSB/LODSW/STOSB/STOSW - load/store a byte/word
  533.          ------------------------------------------------
  534.               These instructions either load in or store a byte or a
  535.          word to or from memory.  The DS:SI register pair points to
  536.          the source data.  These are the registers the CPU will use
  537.          when reading from memory using the LODS instruction.  The
  538.          AX/AL register will hold the number to either read from or
  539.          write to the memory.  So, if DS:SI points to a byte which is
  540.          maybe 60, then a "LODSB" instruction will load in the number
  541.          60 into the AL register.  A LODSB or STOSB will use the AL
  542.          register while the LODSW or STOSW will use the AX register.
  543.               The STOS writes whatever is in the AX/AL register to the
  544.  
  545.  
  546.                                      Page 8
  547.  
  548.  
  549.  
  550.  
  551.  
  552.                                                    The Cracking Manual
  553.  
  554.  
  555.  
  556.          memory pointed to by ES:DI.  So, if ES:DI points to 100:102h
  557.          and if AL held 50, then the byte at 100:102h will hold 50.
  558.               After the instruction is finished, the CPU will either
  559.          increment or decrement SI or DI according to the status of
  560.          the direction flag.  So, if SI was 100h and a "LODSW"
  561.          instruction was performed with a cleared direction flag
  562.          (forward), the SI will now point to 102h.
  563.  
  564.          MOVSB/MOVSW - copies a byte/word from source to destination
  565.          -----------------------------------------------------------
  566.               This instruction gets a byte or a word from the data
  567.          pointed to by DS:SI and copies it to the data pointed to by
  568.          the ES:DI address.  When the instruction is finished, SI and
  569.          DI will be incremented or decremented accordingly with the
  570.          status of the direction flag.  So, if DS:SI pointed to a byte
  571.          with the number 30, a "MOVSB" instruction would copy into the
  572.          byte pointed to by ES:DI the number 30.
  573.  
  574.          REP - repeat
  575.          ------------
  576.               The REP instruction in front of a MOVS/LODS/STOS would
  577.          cause the MOVS/LODS/STOS instruction to be repeated for a
  578.          number of times specified in the CX register.  So, if CX
  579.          contained 5, then "REP STOSB" would store whatever was in the
  580.          AL register into the byte pointed to by ES:DI five times,
  581.          increasing DI each time.
  582.  
  583.          LOOP - looping
  584.          --------------
  585.               The LOOP instruction repeats a block of instructions for
  586.          a certain number of times.  This number will be held in the
  587.          CX register.  Each time we reach this instruction, the CPU
  588.          will decrement the CX register and jump to a specified
  589.          instruction until CX becomes zero.  This instruction looks
  590.          like "LOOP 1A00" where the number indicates the instruction
  591.          address to loop to.
  592.  
  593.          Arithmetic Operators
  594.          --------------------
  595.               Arithmetic instructions allow you to perform various
  596.          arithmetic function of data.  "ADD" and "SUB" work the same
  597.          way as "MOV" instructions do in that it subtracts whatever is
  598.          in the source register from the destination register and
  599.          stores it in the destination register.
  600.               The "MUL" and "DIV" instructions are a bit more
  601.          complicated and they are not used as intensively as the "ADD"
  602.          or "SUB" since they are slow, so we will not talk about them.
  603.               There are also a multitude of other instructions that
  604.          you should familiarize yourself with if you are thinking of
  605.          becoming a serious cracker.  The instructions given above are
  606.          only the BARE minimum that you need.  There is no way around
  607.          learning assembly for better cracking.
  608.  
  609.  
  610.  
  611.  
  612.                                      Page 9
  613.  
  614.  
  615.  
  616.  
  617.  
  618.                                                    The Cracking Manual
  619.  
  620.  
  621.  
  622.                                   THE CRACKING
  623.  
  624.          The Cracking
  625.          ------------
  626.               Now the fun stuff begins.  First, we must discuss the
  627.          different forms of copy protection schemes.  They are
  628.          basically divided into the disk based and manual based copy
  629.          protection schemes.
  630.               With disk based schemes, the software often reads from
  631.          specific sectors on a disk to determine the disk's validity.
  632.          How can this be done?  When you perform a disk format, the
  633.          disk is formatted with specific sector sizes.  Once the
  634.          sector size changes, DOS cannot recognize it, thinking that
  635.          it is a bad sector.  Since this looks like a bad sector, a
  636.          simple DISKCOPY will not work in copying such disks.
  637.          Interrupt 13h (the assembly mnemonic is INT 13) was commonly
  638.          used to handle such copy protections.  It is now very rare to
  639.          encounter the once famed INT 13h copy protection method
  640.          nowadays since it was quite easy to defeat.  Any professional
  641.          commercial software will often use their own custom based
  642.          disk I/O routines.  This involves intimate access to I/O
  643.          ports using IN and OUT instructions.  This is beyond the
  644.          scope of the first release of this manual.  However, if you
  645.          are lucky, the I/O functions might be called from a "CALL"
  646.          instruction in which case you may defeat the protection
  647.          without much difficulty.  Another disk based scheme used to
  648.          denote legality of software is used during the installation
  649.          process of the software.  With certain programs, when you
  650.          install it, it copies the files into the hard drive.  But it
  651.          also sets a specific sector in the hard drive so that the
  652.          program can recognize it.  This is also similar to diskette
  653.          copy protections, but can be defeated in much the same way.
  654.               Thank goodness that disk based copy protections are
  655.          almost completely out of the software industry.  However, a
  656.          sometimes more difficult copy protection scheme has arisen
  657.          that may sometimes prove to be even more difficult to crack.
  658.          These schemes are commonly known as the doc checks in which
  659.          the user must have a copy of the manual to bypass the
  660.          protection.  With programs compiled as true assembly (you can
  661.          call then "normal" programs), these protections are not too
  662.          bad to trace through and crack.  With programs that run
  663.          scripts (such as Sierra games), this can he a real chore
  664.          however.  Why?  It is because it is like running a program
  665.          within a program.  You just have to be very very patient in
  666.          this case, carefully tracing through the instructions.
  667.               As if these copy protection schemes weren't enough,
  668.          software companies have also added trace inhibition schemes
  669.          to their code.  What does this mean?  This means that you
  670.          will have a hell of a time trying to trace through code.
  671.          However, if you know how these things work, it should not be
  672.          too much of a problem.
  673.               Run-time compression/decompression and
  674.          encryption/decryption of files also make changes to the
  675.          program difficult.  In this case, the loader sure comes in
  676.  
  677.  
  678.                                     Page 10
  679.  
  680.  
  681.  
  682.  
  683.  
  684.                                                    The Cracking Manual
  685.  
  686.  
  687.  
  688.          handy.  Also, when the data within the file changes due to
  689.          overlays, loaders are also good to use.
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.                                     Page 11
  745.  
  746.  
  747.  
  748.  
  749.  
  750.                                                    The Cracking Manual
  751.  
  752.  
  753.  
  754.                           DISK BASED COPY PROTECTIONS
  755.  
  756.          Disk Based Copy Protection
  757.          --------------------------
  758.               Since disk based copy protection schemes are rarely
  759.          used, we will not go into great depth in its discussion.
  760.  
  761.          INT 13h
  762.          -------
  763.               I have previously mentioned that INT 13h copy protection
  764.          schemes are hardly ever used anymore.  Nevertheless, it would
  765.          be good practice for the beginner to learn how to defeat the
  766.          code.  You will most likely see INT 13h used with function 2,
  767.          read sector.  This means that:
  768.  
  769.               AH => will contain the number 2 (function 2)
  770.               AL => the number of sectors to read in.  This is
  771.                     commonly only 1 since you just want to check a few
  772.                     sectors for disk validity.
  773.               CH => will contain the cylinder number
  774.               CL => will contain the sector number
  775.               DH => will contain the head number
  776.               DL => will contain the drive number
  777.                     00h - 7Fh for floppies
  778.                     80h - FFh for fixed disks
  779.               ES:BX => will point to the address into which the data
  780.                     read from the disk will be written to
  781.  
  782.               Upon the return for this interrupt, if the carry flag is
  783.          set, that means that the program could not read the sector,
  784.          and therefore the disk is valid.  If the carry flag is clear,
  785.          that meant that INT 13h could read the sector properly and so
  786.          the disk would be bad in the eyes of the program, thinking it
  787.          was a copied disk.
  788.               Okay, now that we know to look for INT 13h in the
  789.          program code, we can begin tracing.  First, we must know the
  790.          difference between debug's "T" and "P".  "T" is the trace
  791.          instruction, which tells it to follow instructions step by
  792.          step.  That also means that in LOOP or REP instruction, the
  793.          trace will patiently go through the loop until finished.
  794.          Also, during CALL instructions, trace will go into the call
  795.          and execute the instructions pointed to by the call
  796.          instruction.  The "P" command is similar to the "T" but with
  797.          the difference in that it traces over instructions.  That
  798.          means that if it encounter a LOOP or REP, it will quickly
  799.          finish up the loop and point to the next instruction.  With a
  800.          CALL, the "P" (proceed) will not go into the subroutine.
  801.          Instead, it will just execute the procedure, then point to
  802.          the next instruction.
  803.               Okay, before you start tracing for hours through a
  804.          program, you must first notice when and where the copy
  805.          protection appears.  Run the program in DOS first and make
  806.          careful note of when things happen.  You might see an intro
  807.          screen, then the music pops up, then the menu comes out.
  808.  
  809.  
  810.                                     Page 12
  811.  
  812.  
  813.  
  814.  
  815.  
  816.                                                    The Cracking Manual
  817.  
  818.  
  819.  
  820.          Notice this so you will know where you are in the program.
  821.               Once you have done that, you can begin debugging the
  822.          program.  Whenever you start out with a program, you use "P"
  823.          to trace through the program.  Be patient as this might take
  824.          a while.  While you are tracing, watch out for CALLs and
  825.          INTerrupts.  When you are just about to execute the step, try
  826.          to remember the segment and offset of the instruction.  The
  827.          segment is the number to the left of the colon while the
  828.          offset is the number to the right.  As you continue tracing
  829.          through the program, you will find that the screen might
  830.          blank and display the intro screen or something like that.
  831.          This is a good sign and it tells you that you are headed in
  832.          the right direction.  Start slowing down when you feel that
  833.          you are near to the copy protection.
  834.  
  835.          Situation 1 - Exit from copy protected CALL
  836.          -------------------------------------------
  837.               Oops, you have traced over a call that accessed drive A.
  838.          Unfortunately, you also exited the program.  That's good.
  839.          You have just narrowed down the location of the copy
  840.          protection code.  Now I hope you remembered the address of
  841.          that CALL.  If not, you gotta start all over to find it.
  842.          Anyway, restart the program now.  Now Go to that instruction
  843.          by "G {segment:address}".
  844.               Did something go wrong?  Did the computer freeze or
  845.          something?  It is most likely that this is an overlay or
  846.          encrypted code or something that caused the code at that
  847.          location to change.  In this case, you will have to remember
  848.          the addresses of various instructions along the way.
  849.          Instructions that you want to take note of are far calls (if
  850.          you remember, calls with a segment:offset address as their
  851.          operand).  You don't have to do this for every call.  As you
  852.          crack more and more, you will get the hang of which
  853.          instructions to keep track of.
  854.               Okay, let's assume you have gotten back into the
  855.          location of the code again.  It is a CALL instruction that
  856.          will access the disk drive.  At this point, try skipping the
  857.          CALL instruction.  To do this, type in "RIP {enter}".  Then
  858.          type in the address of the next instruction.  Then execute
  859.          the do or die instruction, "G".  If the program runs fine
  860.          without asking for the copy protection, congratulations!  You
  861.          have cracked the program.
  862.               If the program freezes or does something weird, restart
  863.          the program and trace back to the suspected copy protected
  864.          location.  Now use the "T" command once and start using "P"
  865.          again.  Remember to write down the address of that CALL
  866.          instruction you just traced into so you can come back to it
  867.          quickly.  As you keep tracing, using the above procedures,
  868.          pretend you eventually come up to an INT 13h instruction.
  869.          See what it does by tracing over it.  Make sure you have a
  870.          disk in drive A too.  If there was no error, force an error
  871.          by turning on the carry flag and proceeding.  With INT 13h
  872.          copy protections, this should be sufficient to crack the
  873.          program.
  874.  
  875.  
  876.                                     Page 13
  877.  
  878.  
  879.  
  880.  
  881.  
  882.                                                    The Cracking Manual
  883.  
  884.  
  885.  
  886.          Situation 2 - Return from copy protected CALL
  887.          ---------------------------------------------
  888.               Okay, the CALL that you just traced over accessed the
  889.          disk drive, but it didn't kick you out.  Keep on proceeding
  890.          and this point.  If there is an instruction that causes you
  891.          to jump because of a carry flag, try fooling around with this
  892.          carry flag and see how the program reacts.  INT 13h copy
  893.          protections are usually simple enough for you to just change
  894.          the carry flag to allow the program to bypass the copy
  895.          protection.
  896.  
  897.          Access to the Hard Drive
  898.          ------------------------
  899.               The cracking for installation software is also the same
  900.          as cracking for the INT 13h.  You just keep tracing until you
  901.          see some disk activity.  At that point, you try messing
  902.          around with some of the conditional jumps to see what
  903.          happens.  If you have the original program, you should run it
  904.          also to see the differences between the valid and invalid
  905.          copies.
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.                                     Page 14
  943.  
  944.  
  945.  
  946.  
  947.  
  948.                                                    The Cracking Manual
  949.  
  950.  
  951.  
  952.                            DOC CHECK COPY PROTECTIONS
  953.  
  954.          Doc Check Copy Protections
  955.          --------------------------
  956.               Okay, we have just quickly scanned over disk based copy
  957.          protections because they are rarely used nowadays.  Doc
  958.          checks will be discussed in greater detail for the rest of
  959.          this manual.
  960.               Unlike the disk based protections, which are based on
  961.          hardware identification, doc checks are based on software
  962.          identification.  Therefore, the only information that will
  963.          indicate that a copy protection is happening is the screen,
  964.          unlike the whirr of the disk drive.  The moral, watch the
  965.          screen.  Because this copy protection is software based, it
  966.          will be more of a challenge to trace, but of course, that is
  967.          the "fun" part of cracking.
  968.  
  969.          The Basics
  970.          ----------
  971.               Make sure you have the COMPLETE version of the program
  972.          you are about to crack.  When you do, run the program in DOS.
  973.          While the program is loading, take note of exactly what goes
  974.          on with the screens, sounds, etc.  Here is what you might
  975.          want to note:
  976.  
  977.               1)  What comes up first?  Is it a standard text output
  978.                   that asks you for the type of graphics adaptor you
  979.                   have, the number of joysticks, the sound card?
  980.               2)  When does the intro screen come up?  Is it after the
  981.                   music starts?  After the copyright notice?  After
  982.                   the text prompt for the graphics mode you will be
  983.                   operating in?
  984.               3)  What happens now?  An animated sequence that brings
  985.                   you through the beginning plot of a game?  If so,
  986.                   can you press a key and escape from it?
  987.               4)  Now what?  Is there a main menu?  When you start the
  988.                   game by selecting the "START GAME" option from the
  989.                   menu, does the copy protection come up immediately?
  990.               5)  If it doesn't come up immediately, when does it come
  991.                   up?
  992.               6)  Does the copy protection only appear when you are
  993.                   playing the game, or does it come up also when you
  994.                   select "CHANGE OPTIONS" from the main menu?
  995.  
  996.          Obviously, these questions are merely prompts for you to
  997.          follow.  Use your own mind in discovering what to take note
  998.          of.  There are no set rules for cracking.  It is a puzzle
  999.          that you must use your mind on.
  1000.               Okay, once you have run the program, go into your
  1001.          debugger (in our case, DEBUG) and load up the program.  One
  1002.          tip to use when you first start out programming is to use the
  1003.          "P" command to trace through code.  As you become a more
  1004.          advanced cracker, you might start seeing patterns in coding.
  1005.          These patterns are characteristic of high level programming
  1006.  
  1007.  
  1008.                                     Page 15
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.                                                    The Cracking Manual
  1015.  
  1016.  
  1017.  
  1018.          languages (Pascal, C, etc.) and are usually the
  1019.          initialization code for the rest of the program.  Use "P" for
  1020.          each instruction, one at a time.  Be patient as this might
  1021.          take a while.
  1022.               Okay, you have been tracing for some time now and
  1023.          finally, you notice something happen.  The screen might have
  1024.          blanked or maybe a message prompting you to enter the
  1025.          graphics mode may have popped up.  Was this what you have
  1026.          noted before?  It should be and you can assure yourself that
  1027.          you are headed in the right direction.  As you keep tracing
  1028.          programs, you notice that CALLs usually do something
  1029.          significant.  A CALL might clear the screen or sound some
  1030.          music.  When it does something rad like this, write down its
  1031.          address as the segment:offset pair.  The segment is the
  1032.          number to the left of the colon while the offset is the
  1033.          number to the right of the colon.  Don't be a dork and set a
  1034.          breakpoint there.  Write it down on paper or something.  We
  1035.          will see later on why breakpoints fail miserably in the cool
  1036.          wares.
  1037.               Why take note of these instructions?  As you trace
  1038.          deeper and deeper into programs, the coding often loads up
  1039.          overlays or maybe decompresses code to the memory location
  1040.          that you have just traced over.  Therefore, if you set a
  1041.          breakpoint there, or execute a "G" instruction to that
  1042.          address, you will fuck up the program and cause your computer
  1043.          to freeze.  We will see why when we examine how breakpoints
  1044.          and single stepping works.
  1045.               Also, while you are tracing using "P", mentally remember
  1046.          the addresses of the CALLs.  That way, if you trace over a
  1047.          call that brought you immediately to the copy protection, you
  1048.          won't have to retrace the code again.  You don't have to
  1049.          write down all of the addresses, of course, just remember one
  1050.          at a time and write them down if they do anything
  1051.          significant.
  1052.  
  1053.          Code Guards Through Keyword Entry
  1054.          ---------------------------------
  1055.               Okay, you know that the copy protection is one in which
  1056.          the program waits for you to type in a keyword that you have
  1057.          to look up in the manual or something.  Here are then
  1058.          following steps you should take.
  1059.  
  1060.          Situation 1 - Return from a copy protected CALL
  1061.          -----------------------------------------------
  1062.               When a copy protection coding reveals itself on the
  1063.          screen, you can have a situation in which you are returned to
  1064.          the debugger, waiting for the next instruction to be
  1065.          executed.  Now, suppose that the CALL asked you to enter a
  1066.          code.  You entered an incorrect code and were returned to the
  1067.          debugger, but you have not exited the program.  Make sure
  1068.          that you have previously recorded the address of this CALL.
  1069.          Now, you can do two things, (1) you can try skipping over the
  1070.          CALL, (2) you can trace on further.  As you become more
  1071.          experienced, you will be able to better decide.  As one with
  1072.  
  1073.  
  1074.                                     Page 16
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080.                                                    The Cracking Manual
  1081.  
  1082.  
  1083.  
  1084.          experience, however, I can say that 90% of the time, you will
  1085.          have to trace further on, but hey, you might get lucky.
  1086.               For now, let's say you are lazy and decide that you want
  1087.          to skip over the call to see what happens.  To do this, you
  1088.          must restart the program.  Then trace your way back to the
  1089.          CALL where the copy protection was located.  Use "G
  1090.          {segment:offset}" to do this.  If, for some reason, the
  1091.          computer freezes when you do this, you will have to use "G"
  1092.          followed by the addresses of the CALLs that you have noted
  1093.          down to be significant.  If that doesn't work, resort to
  1094.          retracing the code over again.  As you become more
  1095.          experienced, you will find that you rarely have to retrace
  1096.          the entire code since you can "feel" what is going on.  Okay,
  1097.          now that you are at the location of the CALL, this is the
  1098.          time to skip over the instruction.  To do this, enter "RIP"
  1099.          and then the address of the next instruction's address.  Now
  1100.          enter the "G" command and see what happens.  If the program
  1101.          runs just fine, you've cracked the program.  If the program
  1102.          kicks you out or crashes, you have to do some more tracing.
  1103.               Okay, so you've decided to continue tracing from the
  1104.          point of the copy protection.  There are usually a bunch of
  1105.          CMP and J? CMPS? instructions after the call.  This point on
  1106.          is the difficulty of cracking for a beginner since you don't
  1107.          know what the fuck is going on.  All those compares and jumps
  1108.          don't mean shit to you are you are about to pass out in
  1109.          frustration.  Don't distress, here are a few tips I can give
  1110.          you.  If these don't work, you gotta find out your own
  1111.          solutions to the problem.
  1112.               Okay, in all probability, the CALL that you just traced
  1113.          over was acting as a read string procedure (like BASIC's
  1114.          INPUT).  That means somewhere in the computer's memory, there
  1115.          lies the code that you typed in and the code that you were
  1116.          supposed to have typed in.  What this would mean is that the
  1117.          code after the CALL will do some sort of string comparison.
  1118.          Look out for these.  It might be hidden inside another CALL
  1119.          if you're lucky.  In such a case, does the program kick you
  1120.          out?  If it does, you have to trace into the call using "T"
  1121.          to see what is going on.  Okay, the string comparison will
  1122.          most likely take the form of some kind of loop.  Maybe "REP
  1123.          CMPSB" or "LOOP".  In the case of the REP CMPSB, there might
  1124.          be a JZ/JNZ or JCXZ/JECXZ that follows it.  When strings
  1125.          match, the CX register will be zero.  If CX is not zero, the
  1126.          strings are not the same and the conditional jump will
  1127.          probably jump to an exit routine.  All you have to do is to
  1128.          change the status of the zero flag.  Then, try out the "G"
  1129.          instruction.  If it still didn't work, start over and do some
  1130.          more tracing.  If the string compare is not of the REP form,
  1131.          there will be some kind of loop that will check between two
  1132.          memory locations.  In such a case, you will just have to
  1133.          become accustomed to realizing that the code is a string
  1134.          compare.  There is no standard code for this.  If you know
  1135.          you have entered a wrong code, trace through the loop and see
  1136.          where in the loop you are thrown out of the loop.  At this
  1137.          point, you can go back to it, change some flags to make sure
  1138.  
  1139.  
  1140.                                     Page 17
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.                                                    The Cracking Manual
  1147.  
  1148.  
  1149.  
  1150.          you stay in the loop.  When you exit through a different
  1151.          location, you have probably bypassed the code and now, you
  1152.          can enter "G" to see what happens.
  1153.  
  1154.          Situation 2 - Exit from a copy protected CALL
  1155.          ---------------------------------------------
  1156.               When a copy protection coding reveals itself on the
  1157.          screen, you can have a situation in which you are not
  1158.          returned to the debugger, instead, causing you to exit the
  1159.          program.  In this case, you have to restart the program and
  1160.          trace into the CALL using "T".  After that, you can start
  1161.          using "P" again to uncover the location of the code.  You
  1162.          will most likely encounter a condition that will resemble
  1163.          situation 1.  Follow its instructions.
  1164.  
  1165.          Shortcuts For Keyword Entry Protections
  1166.          ---------------------------------------
  1167.               With keyword entry systems, you might be lucky to have
  1168.          the codes stuck somewhere into file in its
  1169.          uncompressed/unencrypted form.  This means that you can "see"
  1170.          the keywords in its ASCII format.  This case is cool because
  1171.          you won't have to do any tracing to crack the program.  All
  1172.          you have to do is to dump the contents of the files to find
  1173.          something that looks like a keyword.  (Always backup the file
  1174.          that you are about to alter.)  When you have found such a
  1175.          file and the location of the codes, all you have to do now is
  1176.          to change the codes to values that you know.  For example,
  1177.          one code might call for you to enter "PIRATE".  It's a bitch
  1178.          if you don't know the code.  But if you change the code to
  1179.          your name or something else you will never forget ("CYBORG"),
  1180.          then you'd be set.
  1181.               However, in most instances, you can't simple just type
  1182.          over the old code with your new code.  In high level
  1183.          languages, these codes are stored as strings.  In 'C',
  1184.          strings are stored in their ASCII equivalent.  They are then
  1185.          terminated with a NULL character (this is a 0).  In Pascal,
  1186.          the lengths of the strings are first stored in the first
  1187.          position.  Then, the ASCII is stored.
  1188.  
  1189.          NULL Terminated Strings
  1190.          -----------------------
  1191.               So, if you see zeros after the codes, this is a NULL
  1192.          terminated string.  Now, start at the beginning of the string
  1193.          and enter your code.  Then, enter the '0'.  Make sure your
  1194.          string is less than the original string since 'C' refers to
  1195.          these strings also with pointers.
  1196.  
  1197.          Pre-Length Indentifier
  1198.          ----------------------
  1199.               If you see numbers before strings, enter your own code.
  1200.          Then change the length of the code appropriately.  Make sure
  1201.          you do not exceed the length of the original string.
  1202.  
  1203.  
  1204.  
  1205.  
  1206.                                     Page 18
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.                                                    The Cracking Manual
  1213.  
  1214.  
  1215.  
  1216.          Code Guards Through Pointed Icons
  1217.          ---------------------------------
  1218.               We have a case where we do not type in keywords.
  1219.          Rather, we must use a pointer device such as the cursor keys
  1220.          on the keyboard, the mouse, or joystick.  These protections
  1221.          are a bit more complicated since there are no strings to
  1222.          compare against.  Rather, the input will be a number stored
  1223.          in memory or a register.  This is what makes this copy
  1224.          protection more difficult to crack.  We have to hunt through
  1225.          code to find out which compare instruction is the key.
  1226.               What you have to do is to find the general location of
  1227.          the copy protection code as before.  Then, instead of typing
  1228.          in the keyword, you select the icon.  Like before, you must
  1229.          step slowly through the code and go until the program JUST
  1230.          STOPS asking you for the code.  For example:
  1231.  
  1232.          2E0B:0000 E8740E         CALL   0E77
  1233.          2E0B:0003 38D0           CMP    AL,DL
  1234.          2E0B:0005 7569           JNZ    0070
  1235.          2E0B:0007 CB             RETF
  1236.  
  1237.          You might decide to trace over the call at address xxxx:0000.
  1238.          But then, you see that the screen displayed the icons and you
  1239.          got to select the code.  Then, the procedure does some disk
  1240.          activity and you return to address xxxx:0003.  If you see
  1241.          something happen after you have just finished entering the
  1242.          code or if it is slow in returning you to debug, then,
  1243.          some code must have been performed before you returned.  In
  1244.          this case, you must trace into the CALL to see what has
  1245.          happened.  If not, there is still a small probability that
  1246.          there were some instructions that formatted the code you
  1247.          entered and saved it to a memory location.  (We'll talk about
  1248.          multiple doc checks later.)
  1249.               Realize that most of the programs that you will be
  1250.          cracking have been programed by C or some other high level
  1251.          language.  These languages often use the stack (SS:SP) to
  1252.          pass parameters (variables) or to create local variables for
  1253.          a procedure's use.  Most likely, you will see compares to
  1254.          data contained within the stack such as "CMP AX,WORD PTR
  1255.          [BP+10]" or "MOV DX,WORD PTR [BP+10]".  This is what you hope
  1256.          to find, although not always the case.  If you do see some
  1257.          access via the stack using the BP register as a pointer, you
  1258.          may have something there.  Then, all you would have to do is
  1259.          to mess around the flags register (most likely, JZ/JE will be
  1260.          used) at the compare instruction.
  1261.  
  1262.          Multiple Doc Checks
  1263.          -------------------
  1264.               There are some wares that invoke multiple doc checks,
  1265.          doc checks that pop up either systematically or randomly.  In
  1266.          addition, there could also be two types of this protection.
  1267.          The doc check could be a similar type (eg. typing the code
  1268.          found on page...) or they could be different (eg. typing in
  1269.          the code on page... then select the correct icon), although
  1270.  
  1271.  
  1272.                                     Page 19
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.                                                    The Cracking Manual
  1279.  
  1280.  
  1281.  
  1282.          the latter is more rarely used due to its extensive memory
  1283.          usage.
  1284.  
  1285.          Situation 1 - Similar doc checks
  1286.          --------------------------------
  1287.               Cracking multiple doc checks that are similar is just
  1288.          like cracking with just one doc check.  The procedure to
  1289.          trace is still the same.  Keep Proceeding until you come up
  1290.          to the CALL that contains the copy protection.  Just use the
  1291.          sequences mentioned above.  When you are absolutely positive
  1292.          that the call contains the copy protection (skip the CALL and
  1293.          see what happens; if the protection has been bypassed but
  1294.          appears at other times, you got something), here is what you
  1295.          do.
  1296.  
  1297.               1)  Note what type of CALL it was.  Near if the operand
  1298.                   (number after the CALL) was a four digit number or
  1299.                   far if the operand contained the segment:offset
  1300.                   pair.
  1301.               2)  Trace INTO the call.
  1302.               3)  At the first instruction, note the address inside
  1303.                   the CALL.
  1304.               4)  Then, type in "A" then the address of that very
  1305.                   first instruction.
  1306.               5)  If there was a near call performed, now type in
  1307.                   "RETN", otherwise, type in "RETF".
  1308.               6)  Now run the program ("G") and see what happens.
  1309.  
  1310.          If this call was definitely the copy protection, you should
  1311.          have bypassed the copy protection completely.  Otherwise, you
  1312.          might have a case like situation 2.
  1313.  
  1314.          Situation 2 - Different doc check types
  1315.          ---------------------------------------
  1316.               Again, cracking multiple doc checks are like cracking
  1317.          single doc checks.  You follow the same procedures until you
  1318.          come up to a copy protected location.  Then, you would trace
  1319.          into the code as explained in situation 1 just to make sure
  1320.          that the code is not called up again.  Different doc checks
  1321.          are a bitch to do because you have to manually keep tracing
  1322.          until you find each one to effectively rid yourself of the
  1323.          copy protection.  There is not sure way of getting rid of all
  1324.          the doc checks any other way.  But luckily, there are very
  1325.          few wares out there like this.  Remember, the more the
  1326.          company shoves into the program's memory, the more money it's
  1327.          gonna cost them.
  1328.  
  1329.               Of course, I cannot cover every single type of doc check
  1330.          since there are too many of them.  You'd just have to use
  1331.          your own imagination to solve some of them.
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.                                     Page 20
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.                                                    The Cracking Manual
  1345.  
  1346.  
  1347.  
  1348.                                SPECIAL SITUATIONS
  1349.  
  1350.          Special Situations
  1351.          ------------------
  1352.               What all crackers are faced with at one time or another
  1353.          are situations that call for intuitive thinking to overcome
  1354.          the barrier.  Remember, there is no one sure way of cracking.
  1355.  
  1356.          INT 3 - Problems During Tracing
  1357.          -------------------------------
  1358.               Sometimes, when you start cracking, you just find your
  1359.          instruction pointer messing up.  You keep tracing and
  1360.          tracing, then your computer freezes.  But then, when you type
  1361.          "G" at the beginning of the program, it works just fine.
  1362.          What is happening here?  There are several things that the
  1363.          program could do to impede tracing.  Unless you have a
  1364.          hardware debugger, you have to settle in for more primitive,
  1365.          intuitive methods.  First, we have to find out how a software
  1366.          debugger works.
  1367.               I now introduce you to INT 3 and INT 1.  They are the
  1368.          breakpoint and single stepping interrupts respectively.  We
  1369.          will be looking at INT 3 the most.
  1370.               What happens when you set breakpoints?  Well, here is
  1371.          what the debugger does.  At the address you have specified,
  1372.          the debugger will read in the byte at that address and store
  1373.          it somewhere else in its own memory.  This byte is part of
  1374.          the whole instruction located at that address.  For example,
  1375.          if there was an "INT 13" at that location, the machine
  1376.          language equivalent will be CD13h.  Debug will read in the
  1377.          first byte, CDh, and save it in memory.  The CDh will then be
  1378.          replaced by INT 3 (CCh).  So, the code will now look like
  1379.          CC13h in machine language.  When you unassemble this at the
  1380.          address, you will see "INT 3" (the instruction only takes up
  1381.          one byte) and some gibberish after that.  So, when the CPU
  1382.          comes up to this address, it will encounter INT 3 and will
  1383.          return control to the debugger.  The debugger then replaces
  1384.          the INT 3 with the CDh byte used before.
  1385.               With single stepping, the same thing occurs.  Debug will
  1386.          also insert the INT 3 instruction at the instruction after
  1387.          the one you are about to execute.  Then, internally, a "G"
  1388.          instruction is performed until it reaches the INT 3, at which
  1389.          point, the byte will be replaced and everything will be cool.
  1390.  
  1391.          Use of INT 3 to Call Up Other Interrupts
  1392.          ----------------------------------------
  1393.               This INT 3 deal seems to be cool, working in many
  1394.          situations.  But what if the software vendor reprograms INT 3
  1395.          to point to an INT 21?  Many programs use INT 21 to access
  1396.          DOS functions like reading a file, etc.  There would be a
  1397.          conflict now as the program uses INT 3 to call up DOS while
  1398.          debug wants to use INT 3 for its breakpoints.  There is also
  1399.          another problem.  INT 21 uses two bytes (CD21h) while INT 3
  1400.          uses only one byte (CCh).  Therefore, you cannot replace INT
  1401.          3 with the INT 21.
  1402.  
  1403.  
  1404.                                     Page 21
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.                                                    The Cracking Manual
  1411.  
  1412.  
  1413.  
  1414.               Also, INT 3 could be reprogrammed so that everytime it
  1415.          is used, the program will just exit to its higher process.
  1416.          So everytime you single step, you will be kicked out of the
  1417.          program.
  1418.  
  1419.          Parity Errors with INT 3
  1420.          ------------------------
  1421.               The tough copy protections use the change of memory to
  1422.          obstruct tracing.  Examine the code below:
  1423.  
  1424.          2E0B:0500 FC             CLD
  1425.          2E0B:0501 B80000         MOV    AX,0000
  1426.          2E0B:0504 BB0000         MOV    BX,0000
  1427.          2E0B:0507 BE0005         MOV    SI,0500
  1428.          2E0B:050A BF0010         MOV    DI,1000
  1429.          2E0B:050D B90005         MOV    CX,0500
  1430.          2E0B:0510 AC             LODSB
  1431.          2E0B:0511 345A           XOR    AL,5A                         ;'Z'
  1432.          2E0B:0513 01C3           ADD    BX,AX
  1433.          2E0B:0515 AA             STOSB
  1434.          2E0B:0516 E2F8           LOOP   0510
  1435.          2E0B:0518 3B1E0043       CMP    BX,[4300]
  1436.          2E0B:051C 7403           JZ     0521
  1437.          2E0B:051E E9EF2A         JMP    3010
  1438.          2E0B:0521 D1E0           SHL    AX,1
  1439.  
  1440.          Notice what the program is doing.  It is performing a simple
  1441.          decryption of a block of code from address 500h and putting
  1442.          it in address 1000h.  In addition, there is a checksum being
  1443.          performed at address .  The program is adding all those bytes
  1444.          up, then comparing the number with some other number (a
  1445.          checksum value) in memory at address 4300h.  So what you may
  1446.          say.  When the program is run without any set breakpoints,
  1447.          the program will run fine.  But when you start tracing
  1448.          through the code, or putting a breakpoint somewhere after the
  1449.          loop, the program will cause you to exit.  If you decide to
  1450.          change the program so that it will let you pass regardless of
  1451.          the checksum value, somewhere along the line, the program
  1452.          will fuck up.
  1453.               This goes back to the idea of INT 3.  Right before debug
  1454.          executes an instruction, it places an INT 3 at the next
  1455.          instruction.  In this program, when debug places this
  1456.          interrupt and executes an instruction, the program is reading
  1457.          in this INT 3 at the address and copies it to a different
  1458.          address.  INT 3 is obviously a different number than the
  1459.          other instructions, so the checksum value will be different.
  1460.          So, now that INT 3 is copied to another location in memory,
  1461.          debug also cannot replace that with it's original byte value.
  1462.          Therefore, if you try to force the checksum to match and
  1463.          continue running the program, the program will crash because
  1464.          the INT 3 is causing the instructions after itself to be
  1465.          interpreted incorrectly by the CPU.
  1466.               To bypass this, you have to make sure not to get your
  1467.          INT 3 placed in the wrong place at the wrong time.  Looking
  1468.  
  1469.  
  1470.                                     Page 22
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.                                                    The Cracking Manual
  1477.  
  1478.  
  1479.  
  1480.          at the program, you can keep tracing normally until the SI
  1481.          register points to any byte past the CMP instruction at
  1482.          address 519h.  Then, you can do a "G 518" to finish off the
  1483.          loop quicker.  Debug will place a temporary INT 3 at address
  1484.          518h, but it doesn't matter now since SI will be past 518h.
  1485.          This is obviously a simple example, but it gets the point
  1486.          across that you have to watch where you trace.
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.                                     Page 23
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.                                                    The Cracking Manual
  1543.  
  1544.  
  1545.  
  1546.                                 OVERLAYS/LOADERS
  1547.  
  1548.          Overlays/Loaders
  1549.          ----------------
  1550.               Sometimes, programs will have an initialization code and
  1551.          upon its completion, call up another program or overlay.
  1552.          These programs present unique situations in which it is
  1553.          sometimes difficult, after finding the copy protection code,
  1554.          to write the changes to disk.  Let's see what these programs
  1555.          do before we go on to the next topic of making changes
  1556.          permanent.
  1557.               Loaders are usually small programs that might first ask
  1558.          you for the graphics mode or what sound card you have.  When
  1559.          finished, it will load up another program.  Sometimes, this
  1560.          is done with DOS' interrupt 21h, function 4B00h (load and
  1561.          execute).  This is the same interrupt DOS uses to load up
  1562.          programs when you type them in at the DOS prompt.  You can
  1563.          tell what file is going to be executed by tracing up to the
  1564.          INT 21 instruction and dumping the address pointed to by
  1565.          DS:DX (type in "D DS:DX").  Also, internal procedures could
  1566.          be used to call up the program.  Use what you've learned to
  1567.          trace through them.
  1568.               Code decryptions or dynamic heap allocation where data
  1569.          is to be loaded presents problems as well.  Code that changes
  1570.          as the program progresses makes code changes difficult in the
  1571.          file itself.  And when you want to alter sometime in the data
  1572.          area, something called a heap is often used to store the
  1573.          data.  The thing with the heap is that it can be allocated at
  1574.          anytime and depending on what is currently in memory, you
  1575.          can't tell where the memory is going to be located.  In these
  1576.          cases, you might choose to go with run-time memory overlays
  1577.          (discussed later).
  1578.  
  1579.          Writing the Changes Out to the File
  1580.          -----------------------------------
  1581.               Okay, so you've found the copy protection.  You also
  1582.          know how to bypass it.  Now, the next problem you will most
  1583.          likely encounter is writing it out to a file.  But first,
  1584.          let's assume a simple case.
  1585.  
  1586.          Using a Hex Dump Program
  1587.          ------------------------
  1588.               Included is this package is one of the files from Norton
  1589.          Utilities which does a decent job of finding and changing the
  1590.          contents of files.  Before we exit that debugger, we must
  1591.          know what to look for.
  1592.  
  1593.               1)  At the location of the instruction, copy down the
  1594.                   machine language equivalent of the instruction.  At
  1595.                   instructions after that, also take down their
  1596.                   machine level equivalents.  This is what you will
  1597.                   use to search for the code in the file.
  1598.                   a)  If there is a near call or a near jump or a near
  1599.                       memory access, you can just write down all the
  1600.  
  1601.  
  1602.                                     Page 24
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.                                                    The Cracking Manual
  1609.  
  1610.  
  1611.  
  1612.                       hex numbers.
  1613.                   b)  If there is a far call (CALL DS:[5C10+BX]) or a
  1614.                       far jump (JMP DWORD PTR ES:[5080+BX]) or a far
  1615.                       memory access (MOV AX,WORD PTR ES:[10+SI]), then
  1616.                       do not write these instructions down.  In .EXE
  1617.                       files, anything that is located in different
  1618.                       segments will have different displacement
  1619.                       values.  This is a value in the file.  At the
  1620.                       beginning of the file is a table that tells DOS
  1621.                       where these instructions are located.  When the
  1622.                       program is loaded into memory, the pointers are
  1623.                       changed appropriately to match the memory
  1624.                       location.  So, write down other near
  1625.                       instructions like CLD, JZ 100, INC AX, etc.
  1626.               2)  After you know what to search for, you must now know
  1627.                   what you will have to be changing.  Very often,
  1628.                   NOP's are used to "delete" code.  For example, if
  1629.                   there is a CALL 3140 and we want to skip this call,
  1630.                   we can NOP it out.  The near call takes up three
  1631.                   bytes.  The NOP takes up one byte.  So, type in "A"
  1632.                   at the address of the call and enter "NOP" three
  1633.                   times.  Then unassemble the code to make sure that
  1634.                   the code still looks okay.  Take down the machine
  1635.                   level equivalents of the NOP's (90h).  Same thing
  1636.                   with conditional jumps.  Suppose you have a JZ 90
  1637.                   and you want it to jump to address 90 everytime,
  1638.                   then type in "A" at the jump instruction and enter
  1639.                   "JMP 90".  Then, just write down the machine code as
  1640.                   before.  One thing, however.  You cannot do what I
  1641.                   have just said above with far calls.  Remember, the
  1642.                   numbers will be different in the file as compared to
  1643.                   memory.  So what do you do?  No problemo.  At the
  1644.                   call instruction, trace into the call and place a
  1645.                   "RETF" instruction at the address of the callee.
  1646.                   This will be the location that you will search for
  1647.                   (write down the bytes here) and where you will be
  1648.                   writing to (RETF is CBh in machine language).
  1649.               3)  Finally, after all this is through, you can enter
  1650.                   your file editor and search for the numbers you
  1651.                   wrote down.  Then, you can change the numbers.  Now
  1652.                   run the program and it should be cracked.  But
  1653.                   remember, always backup the file you are about to
  1654.                   change.
  1655.  
  1656.          Using a Memory Overlay
  1657.          ----------------------
  1658.               When do you use these things?  You would use memory
  1659.          overlays when step 3 (stated above) has failed in some way.
  1660.          Maybe you couldn't find the code, or when you change it, the
  1661.          program freezes up.  Don't fret, the memory overlay is here.
  1662.          What is a memory overlay?  It is an external program (TSR)
  1663.          that when it reaches a certain point during program
  1664.          execution, it will change the location in memory you have
  1665.          specified.  It overlays the code during run time.
  1666.  
  1667.  
  1668.                                     Page 25
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.                                                    The Cracking Manual
  1675.  
  1676.  
  1677.  
  1678.               Here is what you will need to do to make the overlay
  1679.          work.  First, you must find some way for the program to call
  1680.          up the overlay code.  This can most easily be done by
  1681.          reprogramming interrupts.  So, the first thing you have to do
  1682.          is look for an interrupt usage near the copy protection code
  1683.          (usually an INT 21h or INT 10h).  When you find this
  1684.          interrupt (it must be fairly close to the code), write down
  1685.          the address of the NEXT instruction.  You must get down the
  1686.          segment and the offset.  Also, get down the current status of
  1687.          the registers.  For interrupts like INT 21h and INT 10h,
  1688.          write down the functions numbers (eg. AX,AL,BX,DX,etc.).
  1689.          Then, keep tracing until the copy protection code.  Get the
  1690.          address of the instruction that you want to change (the
  1691.          segment and the offset).  Also get down the machine language
  1692.          equivalent of the changed code.  This should be all you need
  1693.          for the overlay program.  Here is the overlay program:
  1694.  
  1695. INT_SEG         equ     1DA5h           ;SEG:OFF of instruction after the
  1696. INT_OFF         equ     05D1h           ; calling interrupt
  1697. CHANGE_SEG      equ     2DA5h           ;SEG:OFF of instruction to change
  1698. CHANGE_OFF      equ     0432h
  1699.  
  1700. OVERLAY segment para    'code'
  1701.  
  1702.         assume  cs:OVERLAY,ds:OVERLAY
  1703.  
  1704.         org     100h                    ;This will be a .COM program
  1705.  
  1706. START:  jmp     INITCODE                ;Initialization code
  1707.  
  1708. ;**************************************************************************
  1709.  
  1710. OLDINT          dw      0,0             ;Storage for old interrupt address
  1711.  
  1712. ADDR_OFF        equ     <word ptr [bp+2]>
  1713. ADDR_SEG        equ     <word ptr [bp+4]>
  1714.  
  1715. CR              equ     0Dh             ;Carriage return
  1716. LF              equ     0Ah             ;Line feed
  1717. BEEP            equ     07h             ;Beep
  1718. EOS             equ     '$'             ;End of DOS string
  1719.  
  1720. DISPLACEMENT    equ     CHANGE_SEG - INTSEG
  1721.  
  1722. ;**************************************************************************
  1723.  
  1724. NEWINT  proc    far
  1725.  
  1726.         push    bp                      ;Establish stack frame
  1727.         mov     bp,sp
  1728.         push    ax                      ;Save necessary registers
  1729.         push    bx
  1730.         push    cx
  1731.         push    dx
  1732.  
  1733.  
  1734.                                     Page 26
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.                                                    The Cracking Manual
  1741.  
  1742.  
  1743.  
  1744.         push    si
  1745.         push    di
  1746.         push    ds
  1747.         push    es
  1748.  
  1749.         mov     bx,ADDR_OFF             ;Get offset
  1750.         cmp     bx,INT_OFF
  1751.         jnz     EXIT
  1752.  
  1753.         cmp     ax,0201h                ;Check for AX=0201h     <=(1)
  1754.         jnz     EXIT
  1755.         cmp     bx,0001h                ;Check for BX=0001h     <=(2)
  1756.         jnz     EXIT
  1757.  
  1758.         mov     bx,ADDR_SEG             ;Get segment
  1759.         add     bx,DISPLACEMENT
  1760.         mov     ds,bx                   ;This will be the segment of change
  1761.  
  1762.         ;change the number at the next line to point to the offset of
  1763.         ; the address to be changed
  1764.         mov     bx,1C12h                ;This is the offset of the change
  1765.         mov     al,0EBh                 ;This is the byte to be changed
  1766.         mov     [bx],al
  1767.  
  1768.         ;change the number at the next line to point to the offset of
  1769.         ; the address to be changed
  1770.         mov     bx,1C20h                ;This is the new offset of the change
  1771.         mov     ax,0B8h                 ;This is the byte to be changed
  1772.         mov     [bx],ax
  1773.         mov     al,0                    ;This is the next byte to be changed
  1774.         mov     [bx+2],al
  1775.  
  1776.         pop     es                      ;Restore necessary registers
  1777.         pop     ds
  1778.         pop     di
  1779.         pop     si
  1780.         pop     dx
  1781.         pop     cx
  1782.         pop     bx
  1783.         pop     ax
  1784.         pop     bp
  1785.         iret                            ;Interrupt return
  1786.  
  1787. EXIT:   pop     es                      ;Restore necessary registers
  1788.         pop     ds
  1789.         pop     di
  1790.         pop     si
  1791.         pop     dx
  1792.         pop     cx
  1793.         pop     bx
  1794.         pop     ax
  1795.         pop     bp
  1796.         jmp     dword ptr cs:OLDINT     ;Jump to old interrupt
  1797.  
  1798.  
  1799.  
  1800.                                     Page 27
  1801.  
  1802.  
  1803.  
  1804.  
  1805.  
  1806.                                                    The Cracking Manual
  1807.  
  1808.  
  1809.  
  1810. NEWINT  endp
  1811.  
  1812. ;**************************************************************************
  1813.  
  1814. FINISH  equ     $
  1815.  
  1816. MESSAGE db      "This is an overlay loader.",CR,LF
  1817.         db      "Written by The Cyborg.",CR,LF,BEEP,EOS
  1818.  
  1819. INITCODE:
  1820.         mov     ax,cs
  1821.         mov     ds,ax                   ;DS point to CS
  1822.  
  1823.         mov     ah,9                    ;Print string
  1824.         mov     dx,offset MESSAGE       ;The address of the message
  1825.         int     21h
  1826.  
  1827.         mov     ax,3510h                ;Get old interrupt address
  1828.         int     21h
  1829.         mov     OLDINT[0],bx            ;Save in memory for later use
  1830.         mov     OLDINT[2],es
  1831.  
  1832.         mov     ax,2510h                ;Set new interrupt address
  1833.         mov     dx,offset NEWINT        ;Point to new procedure
  1834.         int     21h
  1835.  
  1836.         lea     dx,FINISH               ;CS:DX of last byte of code to remain
  1837.         int     27h                     ; in memory.  Terminate and stay
  1838.                                         ; resident.
  1839.  
  1840. OVERLAY ends
  1841.  
  1842.         end     START
  1843.  
  1844.          All you have to do is set the first four values in the first
  1845.     four lines of the file.  They are the segment:offset pairs of the
  1846.     interrupt address and the address of the bytes to be changed.
  1847.     Also, change the functions to check for at (1) and (2) to
  1848.     appropriately check for proper code entry.  Then, specify which
  1849.     bytes you will be changing at the specified lines.  Then compile
  1850.     this crack ("ASM OVL {enter}").
  1851.          The next program demonstrates a simple loader.  It also
  1852.     demonstrates what you can do if you have a program that utilizes
  1853.     scripts or dynamically allocated data areas in heap spaces.  This
  1854.     program scans for a known segment in memory for a "keyword".  When
  1855.     it finds this, it can then begin writing new code to overlay the
  1856.     old data.  Note, KEYWORD specifies the keyword to look for.  Then,
  1857.     CRK (0's) is the list of bytes to replace the data areas pointed
  1858.     to by addresses listed in LIST.  The addresses in LIST are
  1859.     displacement addresses.  This means that at the address the
  1860.     keyword was found in, the appropriate number listed in LIST is
  1861.     added to that address.  There are thirteen addresses whose data
  1862.     are to be changed in this case.
  1863.          Also interesting to note is that this program is using two
  1864.  
  1865.  
  1866.                                     Page 28
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.                                                    The Cracking Manual
  1873.  
  1874.  
  1875.  
  1876.     interrupt vectors, INT F1h and INT 21h.  INT 21h is used in the
  1877.     same way as the above overlay program uses it.  It replaces two
  1878.     bytes at offset 1FE5h with CDF1h.  This is the machine language
  1879.     equivalent of INT F1h.  Now, let's examine what INT F1h actually
  1880.     does.  First, it changes the return address in the stack so that
  1881.     instead of returning to the address right after the INT F1h
  1882.     instruction, it will return to another instruction, located at
  1883.     offset 1FE5.  This is the location of the INT F1h instruction.
  1884.     This interrupt, upon its completion, will replace the INT F1h
  1885.     instruction with the original instruction and run the program
  1886.     normally.
  1887.          The loader itself is simple.  It reallocates the memory
  1888.     located to itself to accommodate a "daughter" program, the program
  1889.     that it is going to load.  If it can't find the program or if an
  1890.     error has occurred trying to execute the program, the loader will
  1891.     load itself up as a TSR.  Then, you can run the program via DOS.
  1892.     This loader also checks if INT F1h has been occupied and returns
  1893.     an error if it is.
  1894.  
  1895. LOADER  segment para    'code'
  1896.  
  1897.         assume  cs:LOADER,ss:LOADER
  1898.  
  1899.         org     100h
  1900.  
  1901. BEGIN:  jmp     INIT
  1902.  
  1903. CR      equ     0Dh
  1904. LF      equ     0Ah
  1905. BEEP    equ     07h
  1906. EOLN    equ     '$'
  1907.  
  1908. OPTION  db      1                       ;Options
  1909. CRC     dw      0                       ;Cyclic Redundency Checking data
  1910.  
  1911. START   equ     $
  1912.  
  1913. OLDINT1 dw      0,0
  1914. OLDINT2 dw      0,0
  1915. KEYWORD db      "weat"
  1916. CRK     db      0,0,0,0
  1917. LIST    dw      0h,014h,019h,02Dh,041h,046h,05Ah,05Fh,073h,087h,08Ch,0A0h,0B4h
  1918.  
  1919.         ;********** New Interrupt 1 **********;
  1920.  
  1921. NEWINT1 proc    far
  1922.  
  1923.         push    bp                      ;Establish stack frame
  1924.         mov     bp,sp
  1925.         push    ax                      ;Save registers
  1926.         push    bx
  1927.         push    cx
  1928.         push    dx
  1929.         push    di
  1930.  
  1931.  
  1932.                                     Page 29
  1933.  
  1934.  
  1935.  
  1936.  
  1937.  
  1938.                                                    The Cracking Manual
  1939.  
  1940.  
  1941.  
  1942.         push    si
  1943.         push    ds
  1944.  
  1945.         mov     ax,cs
  1946.         mov     ds,ax
  1947.  
  1948.         mov     ax,word ptr [bp+2]      ;Get offset
  1949.         cmp     ax,1FE7h
  1950.         jnz     EXIT1
  1951.  
  1952. NEXT1:  mov     ax,1FE5h                ;Where to return next
  1953.         mov     word ptr [bp+2],ax
  1954.  
  1955.         mov     ax,word ptr [bp+4]      ;Get segment
  1956.         mov     ds,ax                   ;Put in data segment
  1957.         mov     bx,1FE5h                ;Offset to change
  1958.         mov     ax,0D803h               ;The new code to put in
  1959.         mov     [bx],ax                 ;Store changes
  1960.  
  1961.         mov     ax,cs                   ;Get current data segment
  1962.         mov     ds,ax
  1963.  
  1964.         mov     di,0                    ;Where to start search
  1965.         mov     dx,0FF00h               ;Search the entire segment
  1966.         mov     bx,0
  1967. COMP:   mov     di,bx                   ;Where to begin
  1968.         mov     si,offset KEYWORD       ;Get keyword
  1969.         mov     cx,4                    ;Lenght of keyword
  1970.         repe    cmpsb                   ;Compare until done
  1971.         jz      MATCH
  1972.         inc     bx
  1973.         dec     dx                      ;Done?
  1974.         jz      EXIT1                   ;If no match, exit
  1975.         jmp     COMP
  1976.  
  1977. MATCH:  mov     dx,bx
  1978.         mov     ax,0E07h
  1979.         int     10h
  1980.         mov     bx,offset LIST          ;Get list of codes to change
  1981.         mov     cx,13                   ;Number of locations to change
  1982. NEXT2:  push    cx
  1983.         mov     cx,4                    ;Lenght of string
  1984.         mov     di,[bx]                 ;Get destination
  1985.         add     di,dx
  1986.         mov     si,offset CRK           ;Get string to copy from
  1987.         rep     movsb                   ;Copy String
  1988.         inc     bx                      ;Next location
  1989.         inc     bx
  1990.         pop     cx
  1991.         loop    NEXT2
  1992.  
  1993. EXIT1:  pop     ds                      ;Restore registers
  1994.         pop     si
  1995.         pop     di
  1996.  
  1997.  
  1998.                                     Page 30
  1999.  
  2000.  
  2001.  
  2002.  
  2003.  
  2004.                                                    The Cracking Manual
  2005.  
  2006.  
  2007.  
  2008.         pop     dx
  2009.         pop     cx
  2010.         pop     bx
  2011.         pop     ax
  2012.         pop     bp
  2013.         iret                            ;Interrupt return
  2014.  
  2015. NEWINT1 endp
  2016.  
  2017.         ;********** New Interrupt 2 **********;
  2018.  
  2019. NEWINT2 proc    far
  2020.  
  2021.         push    bp                      ;Establish stack frame
  2022.         mov     bp,sp
  2023.         push    ax                      ;Save registers
  2024.         push    bx
  2025.         push    ds
  2026.  
  2027.         mov     bx,word ptr [bp+2]      ;Get offset
  2028.         cmp     bx,0Ch                  ;See if called from the proper offset
  2029.         jnz     EXIT2                   ;If not, exit
  2030.  
  2031.         cmp     ah,30h                  ;See if want this function call
  2032.         jnz     EXIT2                   ;If not, exit
  2033.  
  2034.         mov     bx,word ptr [bp+4]      ;Get segment
  2035.         add     bx,0F8Dh                ;New segment
  2036.         mov     ds,bx
  2037.         mov     bx,1FE5h                ;New offset
  2038.         mov     ax,0F1CDh               ;The new instruction
  2039.         mov     [bx],ax                 ;Save changes in memory
  2040.  
  2041. EXIT2:  pop     ds                      ;Restore registers
  2042.         pop     bx
  2043.         pop     ax
  2044.         mov     sp,bp
  2045.         pop     bp
  2046.         jmp     dword ptr cs:OLDINT2    ;Call old interrupt
  2047.  
  2048. NEWINT2 endp
  2049.  
  2050. FINISH  equ     $
  2051.  
  2052.         ;********** Initialization Code **********;
  2053.  
  2054. PARAM   dw      0
  2055.         db      80h,0
  2056. PARAM1  dw      5 dup(0)
  2057. PROG    db      8 dup('1234567890')
  2058.  
  2059. MESS    db      'Savage Empire ßeta Crack v1.0  July 15,1991',CR,LF
  2060.         db      'Loader needed only after creating a character.',CR,LF
  2061.         db      "Press {ENTER} at the copy protection.",CR,LF,BEEP,EOLN
  2062.  
  2063.  
  2064.                                     Page 31
  2065.  
  2066.  
  2067.  
  2068.  
  2069.  
  2070.                                                    The Cracking Manual
  2071.  
  2072.  
  2073.  
  2074. ERR1    db      'ERROR: Not enough memory.  '
  2075.         db      'Activating TSR sequence.',CR,LF,BEEP,EOLN
  2076. ERR2    db      'ERROR: Could not load program.  '
  2077.         db      'Activating TSR sequence.',CR,LF,BEEP,EOLN
  2078. ERR3    db      'ERROR: Interrupt vector (0xF1) already occupied.',CR,LF
  2079.         db      ' Release memory before restarting.',CR,LF,LF,BEEP,EOLN
  2080.  
  2081. INIT:   mov     ah,9                    ;Print string
  2082.         mov     dx,offset MESS
  2083.         int     21h
  2084.  
  2085.         mov     ax,35F1h                ;Get interrupt vector
  2086.         int     21h
  2087.         mov     OLDINT1[0],bx           ;Save in memory
  2088.         mov     OLDINT1[2],es
  2089.  
  2090.         cmp     word ptr es:[bx],8B55h  ;Check for vector occupation
  2091.         jnz     CONT1
  2092.  
  2093.         mov     ah,9                    ;Write string
  2094.         mov     dx,offset ERR3
  2095.         int     21h
  2096.         mov     ax,4C03h                ;Exit with error 3
  2097.         int     21h
  2098.  
  2099. CONT1:  mov     ax,25F1h                ;Set interrupt vector
  2100.         mov     dx,offset NEWINT1
  2101.         int     21h
  2102.  
  2103.         mov     ax,3521h                ;Get interrupt vector
  2104.         int     21h
  2105.         mov     OLDINT2[0],bx           ;Save in memory
  2106.         mov     OLDINT2[2],es
  2107.  
  2108.         mov     ax,2521h                ;Change interrupt vector
  2109.         mov     dx,offset NEWINT2
  2110.         int     21h
  2111.  
  2112.         cmp     OPTION,0                ;See if wants to run program
  2113.         jz      EXIT3
  2114.  
  2115.         mov     ax,cs
  2116.         mov     ds,ax
  2117.         mov     es,ax
  2118.         mov     bx,offset ENDCODE       ;Get end of memory
  2119.         shr     bx,1                    ;Convert to paragraphs
  2120.         shr     bx,1
  2121.         shr     bx,1
  2122.         shr     bx,1
  2123.         inc     bx
  2124.         mov     ah,4Ah                  ;Reallocate memory
  2125.         int     21h
  2126.         jnc     OKAY1                   ;If no error, continue
  2127.  
  2128.  
  2129.  
  2130.                                     Page 32
  2131.  
  2132.  
  2133.  
  2134.  
  2135.  
  2136.                                                    The Cracking Manual
  2137.  
  2138.  
  2139.  
  2140.         mov     ah,9h                   ;Write string
  2141.         mov     dx,offset ERR1
  2142.         int     21h
  2143.         jmp     EXIT3
  2144.  
  2145. OKAY1:  mov     ax,cs
  2146.         mov     PARAM,ax
  2147.         mov     PARAM1,ax
  2148.         mov     bx,offset PARAM
  2149.         mov     dx,offset PROG
  2150.         mov     ax,4B00h                ;Load and execute child
  2151.         int     21h
  2152.         jnc     OKAY2                   ;If no error, continue
  2153.  
  2154.         mov     ah,9h                   ;Write string
  2155.         mov     dx,offset ERR2
  2156.         int     21h
  2157.         jmp     EXIT3
  2158.  
  2159. OKAY2:  mov     ax,25F1h                ;Restore interrupt vector
  2160.         lds     dx,dword ptr OLDINT1
  2161.         int     21h
  2162.  
  2163.         mov     ax,2521h                ;Restore interrupt vector
  2164.         lds     dx,dword ptr OLDINT2
  2165.         int     21h
  2166.  
  2167.         mov     ax,4C00h                ;Exit with error code 0
  2168.         int     21h
  2169.  
  2170. EXIT3:  lea     dx,FINISH               ;Offset of booster
  2171.         int     27h                     ;Exit with ejection of booster
  2172.  
  2173. LOADER  ends
  2174.  
  2175.         end     BEGIN
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186.  
  2187.  
  2188.  
  2189.  
  2190.  
  2191.  
  2192.  
  2193.  
  2194.  
  2195.  
  2196.                                     Page 33
  2197.  
  2198.  
  2199.  
  2200.  
  2201.  
  2202.                                                    The Cracking Manual
  2203.  
  2204.  
  2205.  
  2206.                                 CONCLUSION
  2207.  
  2208.     Conclusion
  2209.     ----------
  2210.          Okay, so we've seen the processes of cracking.  If you are
  2211.     just a beginner and don't know much about programming, you
  2212.     probably got lost somewhere right after the introduction.  I would
  2213.     suggest that you spend some time learning assembly before doing
  2214.     anything else.  Actually, you don't have to start out with
  2215.     assembly.  I started programming using BASIC.  When I got really
  2216.     good at it, I jumped into Assembly, regardless of how difficult
  2217.     people said it was.  Assembly is not at all difficult if you have
  2218.     had some previous knowledge of another language.  It is only
  2219.     difficult if you make it hard.  And after you've learned assembly,
  2220.     you get a "feel" for the other languages and can learn them in a
  2221.     matter of days.  Pascal, Modula-2, C, C++, ..., they're are based
  2222.     on assembly language programming.
  2223.          Cracking is like the debugging process of programming.  To
  2224.     become experienced with debugging is to become adept at cracking.
  2225.     You just need lots o' practice as practice makes perfect.
  2226.          One final note.  I got this manual out kinda quickly so there
  2227.     are bound to be errors, inconsistencies in what I've said, unclear
  2228.     passages, etc.  Well, too bad.  If you really want a good manual,
  2229.     tell me or something and I'll consider it.  I got really bored
  2230.     towards the last parts of the manual so it went pretty fast,
  2231.     skipping over some stuff.  If a lot (and I mean A LOT) of people
  2232.     want a better manual, tell me and give me suggestions.  I'll find
  2233.     the time to do it somehow.
  2234.          Anyways, have fun!
  2235.                                        - The Cyborg
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.  
  2249.  
  2250.  
  2251.  
  2252.  
  2253.  
  2254.  
  2255.  
  2256.  
  2257.  
  2258.  
  2259.  
  2260.  
  2261.  
  2262.                                     Page 34
  2263.  
  2264.  
  2265.  
  2266.